The eval Symbol for Axiomatising Variadic Functions
نویسنده
چکیده
This paper describes (and constitutes the source for!) the proposed list4 OpenMath content dictionary. The main feature in this content dictionary is the eval symbol, which treats a list of values as the list of children of an application element. This may, among other things, be employed to state properties of variadic functions. 1 Background and motivation OpenMath is a formal language for (primarily) mathematics. It is not a coherent theory of mathematics, but the standard makes room for and even encourages expressing small fragments of theory in the form of mathematical properties of symbols in content dictionaries. The main purpose of these is to nail down exactly what concept a symbol denotes, and they can take the form of a direct definition of the symbol, but mathematical properties may also clarify a concept in more indirect ways, e.g. by stating that a particular operation is commutative. As a language of formalised mathematical logic, OpenMath is somewhat unusual in allowing application symbols to be variadic—a flexibility that is most commonly used to generalise binary associative operations into general n-ary operations, but it is by no means useful only for that. By contrast, the formal language used in e.g. [2] rather considers the arity to be a built-in property of each function or predicate symbol, and acknowlegdes no particular link between unary function symbol one (f 1 ) and binary function symbol one (f 2 1 ). Variadic application symbols frequently permit a more natural encoding of formulae than a translation to fixed arity symbols would allow, but they raise the problem of how to define this symbol for all the infinitely many forms that an application of it may take. In theoretical mathematical logic, this problem is a minor one since a theory is allowed to have infinitely many axioms; usually they would be generated from a finite set of axiom schemata, but there is no requirement that this be the case. Practical reasoning about a concrete theory does on the other hand require that the axioms of the theory are in some sense known, so one still ends up having to present them in some finite fashion. This is where OpenMath can run into trouble, as the Formal Mathematical Properties have no schematic ability whatsoever. (Having first-class functions lets you do some things as single axioms that more theoretical texts would probably employ schemata for, but first-class functions cannot achieve much in basic syntactical matters.) The OpenMath sequences proposal [1] can be seen as adding some schematic abilities of immediate relevance to variadic application, but although it may look like a simple meta-level mechanism for generating arbitrarily long argument sequences, it is in fact an extension of the base language. This is troublesome both in that it can have unforseen logical consequences (as the proposal acknowledges [1, Sec. 6]) and in that it renders the base OpenMath language far less simple than is currently the case. This content dictionary implements an alternative approach for stating formal properties of variadic functions, namely to introduce one new application symbol with the power to treat a
منابع مشابه
Venerable Variadic Vulnerabilities Vanquished
Programming languages such as C and C++ support variadic functions, i.e., functions that accept a variable number of arguments (e.g., printf). While variadic functions are flexible, they are inherently not type-safe. In fact, the semantics and parameters of variadic functions are defined implicitly by their implementation. It is left to the programmer to ensure that the caller and callee follow...
متن کاملA Characterization of Barycentrically Preassociative Functions
We provide a characterization of the variadic functions which are barycentrically preassociative as compositions of length-preserving associative string functions with one-to-one unary maps. We also discuss some consequences of this characterization.
متن کاملFrom Variadic Functions to Variadic Relations A miniKanren Perspective
We present an implementation of miniKanren, an embedding of logic programming in RRS Scheme that comprises three logic operators. We describe these operators, and use them to define plus , a relation that adds two numbers. We then define plus ∗o, which adds zero or more numbers; plus ∗o takes exactly two arguments, the first of which is a list of numbers to be added or a logical variable repres...
متن کاملVariadic Templates for C++0x
Generic functions and classes typically accept a fixed number of type arguments. However, generic functions and classes that accept a variable number of type arguments have proven to be a very useful, even though there is no support for this feature in C++. Numerous foundational libraries rely on clever template and preprocessor tricks to emulate such variable-length templates. By several measu...
متن کاملRelaxations of associativity and preassociativity for variadic functions
In this paper we consider two properties of variadic functions, namely associativity and preassociativity, that are pertaining to several data and language processing tasks. We propose parameterized relaxations of these properties and provide their descriptions in terms of factorization results. We also give an example where these parameterized notions give rise to natural hierarchies of functi...
متن کامل